import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:flutter/foundation.dart';
import 'package:hockey/extensions/jzx_json_extension.dart';
part 'jzx_goods_data.freezed.dart';
part 'jzx_goods_data.g.dart';

@freezed
class JzxGoodsData with _$JzxGoodsData {
  const factory JzxGoodsData({
    @JzxJsonAlwaysString() @Default('') String goodsId,
    @JzxJsonAlwaysString() @Default('') String code,
    @JzxJsonAlwaysString() @Default('') String icon,
    @JzxJsonAlwaysString() @Default('') String type,
    @JzxJsonAlwaysString() @Default('') String tags,
    @JzxJsonAlwaysNum() @Default(0) num subType,
    @JzxJsonAlwaysNum() @Default(0) num discount,
    @JzxJsonAlwaysNum() @Default(0) num originalPrice,
    @JzxJsonAlwaysNum() @Default(0) num price,
    @JzxJsonAlwaysNum() @Default(0) num exchangeCoin,
    @JzxJsonAlwaysNum() @Default(0) num originalExchangeCoin,
    @JzxJsonAlwaysNum() @Default(0) num originalPriceRupee,
    @JzxJsonAlwaysNum() @Default(0) num priceRupee,
    @JzxJsonAlwaysNum() @Default(0) num localPaymentPriceRupee,
    @Default(false) bool isPromotion,
    @JzxJsonAlwaysNum() @Default(0) num localPayOriginalPrice,
    @JzxJsonAlwaysNum() @Default(0) num localPayPrice,
    @JzxJsonAlwaysNum() @Default(0) num sortDesc,
  }) = _JzxGoodsData;

  factory JzxGoodsData.fromJson(Map<String, Object?> json) =>
      _$JzxGoodsDataFromJson(json);
}

@freezed
class JzxOrderData with _$JzxOrderData {
  const factory JzxOrderData({
    @JzxJsonAlwaysString() @Default('') String goodsCode,
    @JzxJsonAlwaysString() @Default('') String goodsName,
    @JzxJsonAlwaysString() @Default('') String orderNo,
    @JzxJsonAlwaysNum() @Default(0) num payAmount,
    @JzxJsonAlwaysNum() @Default(0) num paidAmount,
    @JzxJsonAlwaysString() @Default('') String paidCurrency,
  }) = _JzxOrderData;

  factory JzxOrderData.fromJson(Map<String, Object?> json) =>
      _$JzxOrderDataFromJson(json);
}
